<?php
include("connect.php");
$ActID=$_REQUEST['ActID'];
$UserID=$_REQUEST['UserID'];
$sql="select Activities.ActName,DATEDIFF(EndTime,StartTime) as time,count(*) as num from Dynamic,Activities where UserID='".$UserID."' and Activities.ActID=Dynamic.ActID and Activities.ActID='".$ActID."'";
mysqli_query($conn,"set names utf8mb4");
$result=mysqli_query($conn,$sql);
$data=Array();
class activity{
	public $ActName;
	public $time;
	public $num;
}
while($row=mysqli_fetch_array($result,MYSQL_ASSOC)){
	$act=new activity();	
	$act->ActName=urlencode($row["ActName"]);
	$act->time=urlencode($row["time"]);
	$act->num=urlencode($row["num"]);
	$data[]=$act;
}
$json=json_encode($data);
echo urldecode($json);
?>